turn on OsPath build flag by default
authorJoey Hess <joeyh@joeyh.name>
Fri, 5 Sep 2025 16:44:46 +0000 (12:44 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 5 Sep 2025 16:44:46 +0000 (12:44 -0400)
It was already default in stack builds, now it is default in cabal
builds as well.

Add build warnings when git-annex is built without the OsPath build flag.

git-annex version: Report on whether it was built with the OsPath build flag.

Having the flag on by default was always the plan, and this is a good time to
make the change. A bit of added urgency comes from the close-on-exec leak
issue. Fixing that is going to need reimplentation of things like openFile.
Needing to reimplenment it twice is not very appealing, especially since the
FilePath version of it has an implementation that cannot be easily copied and
tweaked. If OsPath is on by default, I can start with only implementing
openFile for it, and fix the bug in that build. And perhaps avoid doing the
extra work that will later get thrown away when this transition finishes.

Note that at this point, Debian still needs to package file-io. Hopefully, they
will package it, rather than turning off the OsPath build flag.

BuildFlags.hs
CHANGELOG
doc/todo/RawFilePath_conversion.mdwn
git-annex.cabal

index d273c216e45e9163e96d233e0ae56dae3009a404..8724b94e45e86af522b757d7faccdb80b52cc10a 100644 (file)
@@ -69,6 +69,11 @@ buildFlags = filter (not . null)
        , "Testsuite"
        , "S3"
        , "WebDAV"
+#ifdef WITH_OSPATH
+       , "OsPath"
+#else 
+#warning Building without the OsPath build flag set results in slower filename manipulation and is not recommended.
+#endif
        ]
 
 -- Not a complete list, let alone a listing transitive deps, but only
index 379d28a732b54d130fa6855cba9e94568f724946..2297edeceef6647cd96b82f21885d38cecff18f1 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,10 @@ git-annex (10.20250829) UNRELEASED; urgency=medium
   * drop: --fast support when dropping from a remote.
   * Fix crash operating on filenames that are exactly 21 bytes long
     and begin with a utf-8 character.
+  * git-annex.cabal: Turn on the OsPath build flag by default.
+  * Add build warnings when git-annex is built without the OsPath
+    build flag.
+  * version: Report on whether it was built with the OsPath build flag.
 
  -- Joey Hess <id@joeyh.name>  Fri, 29 Aug 2025 12:34:06 -0400
 
index c10b62cf2efe78803ed17d633ac056fe5ca69aef..b488353a60fe7bb3ea96071df2175e815d57c4db 100644 (file)
@@ -12,10 +12,11 @@ But this conversion is not yet complete. This is a todo to keep track
 of the status.
 
 * The OsPath build flag makes git-annex build with OsPath. Otherwise,
-  it builds with RawFilePath. The plan is to make that build flag the
-  default where it is not already as time goes on. And then eventually
-  remove the build flag and simplify code in git-annex to not need to
-  support two different build methods.
+  it builds with RawFilePath. That build flag is now on by default,
+  and there is a build warning when it is not set.
+
+* The plan is to eventually remove the build flag and simplify code in
+  git-annex to not need to support two different build methods.
 
 * unix has modules that operate on RawFilePath but no OSPath versions yet.
   See https://github.com/haskell/unix/issues/240
index dda13f70711c651a86f58f80de2dadf0bc954107..484e94abfdbf01fc421db23099d76e4e6d57660d 100644 (file)
@@ -177,6 +177,7 @@ Flag Servant
 
 Flag OsPath
   Description: Use the os-string library and related libraries, for faster filename manipulation
+  Default: True
 
 Flag Benchmark
   Description: Enable benchmarking